package com.chzu.controller;

import com.chzu.pojo.SysPermission;
import com.chzu.result.JsonResult;
import com.chzu.result.QueryInfo;
import com.chzu.service.SysPermissionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author lz
 * @Version 1.0
 * @Company 滁州大健康与养老产业研究院
 * @ClassName SysPermissionController
 * @Description TODO
 * @Date 2022/02/02 17:32
 */
@RestController
@Api(tags = "权限数据的接口")
@RequestMapping("/permission")
public class SysPermissionController {

    @Resource
    private SysPermissionService permissionService;

    @ApiOperation("分页查询权限信息")
    @PostMapping("/findPage")
    public JsonResult<Object> findPermission(@RequestBody QueryInfo queryInfo) {
        return permissionService.findPermission(queryInfo);
    }

    @ApiOperation("添加权限信息")
    @PostMapping("/insert")
    public JsonResult<Object> insertPermission(@RequestBody SysPermission permission) {
        return permissionService.insertPermission(permission);
    }

    @ApiOperation("修改权限信息")
    @PutMapping("/update")
    public JsonResult<Object> updatePermission(@RequestBody SysPermission permission) {
        return permissionService.updatePermission(permission);
    }

    @ApiOperation("删除权限信息")
    @DeleteMapping("/delete/{id}")
    public JsonResult<Object> deletePermission(@PathVariable("id") Integer id) {
        return permissionService.deletePermission(id);
    }

    @ApiOperation("查询全部权限信息")
    @GetMapping("/findAll")
    public JsonResult<Object> findAllPermission() {
        return permissionService.findAllPermission();
    }

}
